package com.gorkr.bio.multi_thread;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author gorkr
 * @date 2022/05/31 00:11
 **/
public class Server {
    public static void main(String[] args) {
        try {
            // 1. 注册端口
            ServerSocket ss = new ServerSocket(9999);

            while (true){
                Socket socket = ss.accept();
                // 创建独立的线程来处理与这个客户端socket的通信需求
                new ServerThreadReader(socket).start();

            }

        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
    